﻿#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

#endregion

namespace Weazel.Badger
{
  [Serializable]
  public class Configuration
  {										
		/// <summary>
		/// Set true to convert $display directives into 
		/// corresponding VHDL code. If this property it not 
		/// set all $display directives will be ignored. 
		/// If set the resulting VHDL design cannot be synthesized.
		/// </summary>
		private bool convertDisplayDirectives;
		public bool ConvertDisplayDirectives
		{
			get { return convertDisplayDirectives; }
			set { convertDisplayDirectives = value; }
		}

		/// <summary>
		/// True to create an Xilinx ISE project file
		/// for the output
		/// </summary>
		private bool createXilinxIseProjectFile;
		public bool CreateXilinxIseProjectFile
		{
			get { return createXilinxIseProjectFile; }
			set { createXilinxIseProjectFile = value; }
		}

    /// <summary>
    /// True to divide the clock by 2
    /// </summary>
    private bool divideClock = true;
    public bool DivideClock
    {
      get { return divideClock; }
      set { divideClock = value; }
    }

		/// <summary>
		/// If this option is set the tool will create ports
		/// for, and bind them to, all unconnected nets in the system
		/// </summary>
		private bool createPortsOnTopEntityForUnconnectedNetsInSystem;
		public bool CreatePortsOnTopEntityForUnconnectedNetsInSystem
		{
			get { return createPortsOnTopEntityForUnconnectedNetsInSystem; }
			set { createPortsOnTopEntityForUnconnectedNetsInSystem = value; }
		}

		/// <summary>
		/// True if the tool should add clock and reset generation
		/// processes to the system entity
		/// </summary>
		private bool createClockAndResetGenerationProcesses;
		public bool CreateClockAndResetGenerationProcesses
		{
			get { return createClockAndResetGenerationProcesses; }
			set { createClockAndResetGenerationProcesses = value; }
		}

		/// <summary>
		/// Name of 'system' to convert. Only used
		/// if there are multiple systems in the design
		/// </summary>
		private string systemToConvert;
		public string SystemToConvert
		{
			get { return systemToConvert; }
			set { systemToConvert = value; }
		}

    /// <summary>
    /// The name fo the click signal on the top level. Must be different
    /// from the "inner" normal click name if the clock is divided
    /// </summary>
    private string topLevelClockName = "outer_clock";
    public string TopLevelClockName
    {
      get { return topLevelClockName; }
      set { topLevelClockName = value; }
    }

		/// <summary>
		/// Name of the clock signal for the resulting VHDL design
		/// </summary>
		private string clockName;
    public string ClockName
    {
      get { return clockName; }
      set { clockName = value; }
    }

		/// <summary>
		/// Name of the reset signal for the resulting VHDL design
		/// </summary>
		private string resetName;
		public string ResetName
		{
			get { return resetName; }
			set { resetName = value; }
		}

		/// <summary>
		/// True to print various "debug" messages to the console
		/// during conversion.
		/// </summary>
		private bool verbose;
		public bool Verbose
		{
			get { return verbose; }
			set { verbose = value; }
		}

		/// <summary>
		/// The destination folder for the resulting VHDL files.
		/// </summary>
		private string outputFolder;
    public string OutputFolder
    {
      get { return outputFolder; }
			set { outputFolder = value; }
    }

    public Configuration()
    {
			this.clockName = "clock";
			this.resetName = "reset";
    }

		public override string ToString()
		{
			StringBuilder str = new StringBuilder();
			str.Append("Convert display directived: " + this.convertDisplayDirectives);
			str.Append("\nCreate Xilinx ISE project file: " + this.createXilinxIseProjectFile);
			str.Append("\nSystem: " + systemToConvert);
			str.Append("\nClock name: " + this.clockName);
			str.Append("\nReset name: " + this.resetName);
			str.Append("\nVerbose: " + this.verbose);
			str.Append("\nOutput folder: " + this.outputFolder);

			return str.ToString();
		}
  }
}
